/*
 * Phone.cpp
 *
 *  Created on: 19 ��� 2010
 *      Author: Sartios
 */

#include "TeacherPhone.h"
#include "../../PhonesSingletonFactory/PhonesSingletonFactory.h"

TeacherPhone::TeacherPhone() {
	owner_=NULL;
	phone_=NULL;
}
TeacherPhone::TeacherPhone(const IPhone *phone,const ITeacher *teacher){
	if((NULL!=phone)&&(NULL!=teacher)){
		setPhone(phone);
		setOwner(teacher);
	}
}

TeacherPhone::~TeacherPhone() {
	delete owner_;
	delete phone_;
}

void	TeacherPhone::setOwner(const ITeacher *owner){
	if(NULL!=owner){
		//owner_= new Teacher(owner);
	}
}

ITeacher *	TeacherPhone::getOwner(void)const{
	if(NULL!=owner_){
		return owner_;
	}
}

void		TeacherPhone::setPhone(const IPhone *phone){
	if(NULL!=phone){
		phone_ = PhonesSingletonFactory::getInstance()->getPhone(phone->getCategory());
		if(NULL!=phone_){
			phone_->setNumber(phone->getNumber());
		}
	}
}

IPhone	*	TeacherPhone::getPhone()const{
	if(NULL!=phone_){
		return phone_;
	}
	return NULL;
}

